//
//  DTHomeMainTableViewController.m
//  DoThinkProperty
//
//  Created by YangJian on 15/9/23.
//  Copyright (c) 2015年 DoThink. All rights reserved.
//

#import "DTHomeMainTableViewController.h"
#import "DTHomeFirstTableViewCell.h"
#import "DTHomeSecondTableViewCell.h"
#import "DTHomeThirdTableViewCell.h"
#import "Header.h"
typedef NS_ENUM(NSInteger, HaveNullArray)
{
    HaveNullArrayYes = 2,
    HaveNullArrayNo = 1,
};
@interface DTHomeMainTableViewController ()

@property(nonatomic,assign)NSInteger pageNumber;

@end

@implementation DTHomeMainTableViewController


- (void)viewDidLoad {
    [super viewDidLoad];
    
    //self.tableView.backgroundColor = [UIColor whiteColor];
    [self setupRightNotificationButtonItem];

    [self.tableView registerClass:[DTHomeFirstTableViewCell class] forCellReuseIdentifier:@"First"];
    [self.tableView registerClass:[DTHomeSecondTableViewCell class] forCellReuseIdentifier:@"Second"];
    [self.tableView registerClass:[DTHomeThirdTableViewCell class] forCellReuseIdentifier:@"Third"];
//    [self.tableView registerClass:[SYHTTableViewCell class] forCellReuseIdentifier:@"HomeFT"];
//    [self.tableView registerClass:[SYHFTableViewCell class] forCellReuseIdentifier:@"HomeFF"];

    UIBarButtonItem * backButtonItem = [[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"tb_class@2x.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] style:UIBarButtonItemStylePlain target:self action:@selector(didClickBackButtonItemAction:)];
    self.navigationItem.leftBarButtonItem = backButtonItem;
    // Do any additional setup after loading the view.
}

- (void)setupRightNotificationButtonItem
{
    UIBarButtonItem * favoriteButtonItem = [[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"tb_personal@3x.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] style:UIBarButtonItemStylePlain target:self action:@selector(didClickFavoriteButtonItemAction:)];
    self.navigationItem.rightBarButtonItem = favoriteButtonItem;
}

- (void)didClickFavoriteButtonItemAction:(UIBarButtonItem *)buttonItem
{
    
}


- (void)didClickBackButtonItemAction:(UIBarButtonItem *)buttonItem
{
 
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    // Return the number of sections.
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    // Return the number of rows in the section.
    return 3;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.row == 1)
    {
        return 150;
    }else
    {
        return 200;
    }
}

//- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
//{
//    if (section == 0) {
//        return SCREEN_HEIGHT/5+20;
//    }else
//    {
//        return 5;
//    }
//}
//-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
//{
//    if (section == 8) {
//        return 50;
//    }
//    return 0.1f;
//}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
        if(indexPath.row == 0)
        {
            DTHomeFirstTableViewCell *firstCell = [tableView dequeueReusableCellWithIdentifier:@"First" forIndexPath:indexPath];
            return firstCell;
        }
        else if(indexPath.row == 1)
        {
            DTHomeSecondTableViewCell *secondCell = [tableView dequeueReusableCellWithIdentifier:@"Second" forIndexPath:indexPath];
            return secondCell;
        }
        else
        {
            DTHomeThirdTableViewCell *thirdCell = [tableView dequeueReusableCellWithIdentifier:@"Third" forIndexPath:indexPath];
            return thirdCell;
        }
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
